Every event GBML has, in the order the game runs them during one frame, with a link to the page for each.
Events explains what an event is: a piece of code the game calls at the moment its name promises, so you write the code and never call it yourself. This page is the calendar. It lists every event there is, says when in a frame each one runs, and links to the page for each. The order of a frame draws the same sequence as a diagram; this page adds where every event sits in it, including the ones that run outside the frame loop, and ends with the order everything happens in when a room opens.
A frame is one pass of the game's main loop. The GBA draws 60 of them a second, and in each one the game runs your events, moves things, and draws the screen. Which event runs first matters whenever two of them touch the same variable.
| Step | What happens | Events that run |
|---|---|---|
| 1 | the frame starts | Step Begin |
| 2 | alarm countdowns | Alarm 0 to 11, for each alarm that reaches 0 |
| 3 | the buttons are read | Button Pressed, Held and Released |
| 4 | the main event | Step |
| 5 | things move, then follow paths | Path End, when a path finishes |
| 6 | position is checked against the room and the view | Beyond Room, Hit Room Edge, Beyond View, Inside View |
| 7 | overlaps are found, then reported | Collision with an object |
| 8 | the frame's logic ends | Step End |
| 9 | the frame is drawn | Animation End, then Draw Begin, Draw, Draw End, Draw GUI Begin, Draw GUI, Draw GUI End |
| 10 | the frame has been shown; now the instances destroyed in it are finished off | Destroy, then Cleanup, for each instance destroyed this frame |
Movement in step 5 is not an event: it applies speed and direction (or hspeed and vspeed), friction and gravity for you, after every Step has run. That is why code in Step sets a speed instead of moving x by hand, and why x still holds the frame's starting position during Step.
Two details in step 9. Animation End runs when a sprite's animation wraps past its last frame, and it runs before the Draw events. An object with no Draw event of its own has its sprite drawn automatically, after every object's Draw Begin and before any object's Draw. Once you write a Draw event for an object, that automatic drawing stops for it: call draw_self() in your Draw if you still want the sprite.
Within one step, the game handles one object at a time, in the order the objects are listed in your project. For each object, every instance of it runs the event, in slot order. That is usually the order they were made in, though a new instance can take the slot of one that was destroyed. Then the game moves on to the next object. So all of one object's Step events run before any of the next object's.
Setting a variable on another object. All of the ways work from any event: through an instance variable (other_car.hit = 1;), inside with (obj_car) { hit = 1; }, through other in a Collision event, and on the result of instance_nearest (or any call that gives an instance). The write is made the moment the line runs, and the other instance sees it from then on. What decides whether it reacts this frame is where that object stands in the order above. If the object that gets the write is listed after the one writing, its Step reads the new value in the same frame. If it is listed before, its Step for this frame has already run, so it reads the value on the next frame. The same goes for a Step that sets the variable back: if the receiving object's own Step clears or recounts the variable every frame (a hit timer it sets to 0, say), and it runs after the write, the write is gone before anything uses it. When a write seems to do nothing, look at which of the two objects runs first, and at what the receiving object's own Step does with that variable. To make the order certain, let the receiving object do the work: have it check in its own Step (with with (obj_rival), say) and apply the result to itself.
You never need to rely on that between objects. Your code can, though, when it matters: Collision states its own order as a promise, because it is the one event where two objects can each have code for the same meeting.
Some events run at one moment in an instance's life or the game's, instead of on a frame schedule.
| Event | When it runs |
|---|---|
| Create | once, when the instance is made, right after its object's own settings (sprite, Visible, Solid...) are put on it |
| Destroy | once, at the end of the frame in which instance_destroy() was called on the instance (step 10) - not when it is called: the instance finishes that frame first |
| Cleanup | once, when the instance is really removed: at the end of the frame it was destroyed in, or when its room ends (a Persistent room is kept instead, and its instances get Cleanup only if the game later forgets the room) |
| Game Start | once per instance placed in the game's first room, only ever for that first room |
| Room Start | once per instance, when a room becomes the current one |
| Room End | once per instance, as a room stops being the current one |
| Region Exited, Region Entered | once per instance (Game Boy Advance, worlds only), when the player arrives in a different region than the last one: after the new part of the world has been made and after its Room Start, Exited first |
| User 0 to 15 | only when your own code, or a cutscene, asks for one by name with event_call |
Destroy and Cleanup differ on purpose. Destroy is for something that has to happen because an instance was destroyed, such as spawning an explosion. It waits for the end of the frame, so the instance finishes the frame it was destroyed in first. Cleanup is for something that must happen whenever the instance is gone, however it went. A room change removes every instance that is not persistent and runs only Cleanup for it, never Destroy: leaving a room is not the instance being destroyed.
A room opens when the game starts, and again every time the game changes room (room_change, room_next, room_restart, or a door). It all happens once, in one go, before the room's first frame. This is the order:


1. It is made where you put it in the room, so x and y already hold that place. 2. Its object's own settings go on it: the sprite, mask, Visible, Solid and Persistent boxes of the object editor. 3. Its object's Create event runs. 4. If it is a door, the settings the door dialog saved for it land now: where it leads, its number, whether it is locked, and its transition. 5. Its own creation code runs. That is the code you wrote for this one copy: right-click the copy in the Room Editor and choose Instance Creation Code. 6. If you gave it a path in the Room Editor, it starts following the path.
Only then does the room's first frame begin, at step 1 of the frame.
Coming back to a Persistent room the game kept is shorter. Steps 1 to 3 do not happen: nothing is made, so no Create, no creation code and no room creation code runs. The instances that were set aside are put back exactly as they were, and step 4 runs for them: Room Start runs for every instance in the room, the ones that came back included.
Creation code runs after Create, so anything that depends on a per-instance value goes there too. A per-instance value is a number, or some text, that only one placed copy has. Say every turret starts with ten shots, but one turret in the room should start with three:
// obj_turret, Create event: every turret starts the same way.
shots = 10;// Creation code of ONE turret in the room. It runs after the Create event above.
shots = 3;If Create had worked something out from shots (a bar 4 pixels wide for each shot, say), that sum would have used the 10 and would never hear about the 3. Work such a thing out where the number is final: in that creation code, or later, in Step or Draw.
One more thing follows from "one at a time": when an instance's Create runs, the instances after it in the room's list have not been made yet, so its Create cannot find them.
Steps 1 to 8 run only when the game is not paused (game_pause), no room transition is playing, and no cutscene is running. During any of those, no Step, Alarm, Button, Collision or room-edge event runs, and instances do not move.
Step 9 does not stop. The Draw events still run on those frames. That is what lets a pause menu, drawn in Draw GUI, appear on a frozen game, and why the screen keeps redrawing during a room transition. Animation End and the sprite animation behind it do run during a room transition and a cutscene, but not while the game is paused, unless the project unticked Stop animations on pause in Project Settings (it is ticked in every project).
Each event above has its own page with its exact rule and an example. These are the ones that surprise people most often: